home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / cool / cool.lha / ice / pisces / flex / MISC < prev    next >
Encoding:
Internet Message Format  |  1991-09-04  |  7.4 KB

  1. From rpj%cadillac.cad.mcc.com@mcc.com Mon Feb  5 10:08:19 1990
  2. Return-Path: <@MCC.COM:rpj%cadillac.cad.mcc.com@mcc.com>
  3. Posted-Date: Sat, 3 Feb 90 11:06:36 CST
  4. Date: Sat, 3 Feb 90 11:06:36 CST
  5. From: rpj%cadillac.cad.mcc.com@mcc.com (Rich Johns)
  6. To: fburke@samwise.csc.ti.com
  7. Subject: FLEX
  8.  
  9.  
  10. -----------------------------MISC---------------------------
  11.  
  12. Miscellaneous flex stuff.  In here you'll find an out-of-date VMS makefile
  13. for flex and notes someone sent me regarding converting flex to deal with
  14. 8 bit characters.  This stuff is provided so that ambitious folks can pick
  15. it up and turn it into something viable.  I'd appreciate being sent any
  16. updates resulting from work on this.
  17.  
  18. The makefile is from Fred Brehm (fwb@demon.siemens.com); the 8 bit chars
  19. >from Earle Horton (arizona!earleh@eleazar.Dartmouth.EDU).
  20.  
  21.  
  22.  
  23. ############################ VMS MAKEFILE ##############################
  24.  
  25. # VMS make file for "flex" tool
  26.  
  27. # Redefine the following for your own environment
  28. BIN = tools$$exe
  29. LIB = tools$$library
  30. INC = tools$$include
  31. MAN = tools$$manual
  32. LINKFLAGS = ,$(LIB):cc/opt
  33.  
  34. SKELETON_FILE = "DEFAULT_SKELETON_FILE=""$(LIB):FLEX.SKEL"""
  35. F_SKELETON_FILE = "FAST_SKELETON_FILE=""$(LIB):FLEX.FASTSKEL"""
  36.  
  37. CCFLAGS = VMS
  38. FLEX_FLAGS = -is
  39.  
  40. FLEXOBJS = ccl.obj dfa.obj ecs.obj main.obj misc.obj nfa.obj parse.obj \
  41. scan.obj sym.obj tblcmp.obj yylex.obj
  42.  
  43. OBJ = ccl.obj,dfa.obj,ecs.obj,main.obj,misc.obj,nfa.obj,parse.obj,\
  44. scan.obj,sym.obj,tblcmp.obj,yylex.obj
  45.  
  46. default : flex
  47. install : inc lib bin man
  48. inc : $(INC):flexskeldef.h $(INC):fastskeldef.h $(INC):flexskelcom.h
  49. lib : $(LIB):flex.skel $(LIB):flex.fastskel
  50. bin : $(BIN):flex
  51.     flex :== $$ $(BIN):flex
  52. man : $(MAN):flex.doc
  53.  
  54. $(INC):flexskeldef.h : flexskeldef.h
  55.     copy flexskeldef.h $(INC)
  56. $(INC):fastskeldef.h : fastskeldef.h
  57.     copy fastskeldef.h $(INC)
  58. $(INC):flexskelcom.h : flexskelcom.h
  59.     copy flexskelcom.h $(INC)
  60. $(LIB):flex.skel : flex.skel
  61.     copy flex.skel $(LIB)
  62. $(LIB):flex.fastskel : flex.fastskel
  63.     copy flex.fastskel $(LIB)
  64. $(BIN):flex.exe : flex.exe
  65.     copy flex.exe $(BIN)
  66. $(MAN):flex.doc : flex.doc
  67.     copy flex.doc $(MAN)
  68.  
  69. flex : flex.exe
  70.     flex :== $$ 'f$$environment("default")'flex
  71.  
  72. flex.exe : $(FLEXOBJS)
  73.     link /exe=flex $(OBJ) $(LINKFLAGS)
  74.  
  75. parse.h : parse.c
  76.  
  77. parse.c : parse.y
  78.     yacc :== $$ sys$$sysroot:[shellexe]yacc
  79.     yacc -d parse.y
  80.     copy y_tab.c parse.c
  81.     copy y_tab.h parse.h
  82.     del y_tab.h;*,y_tab.c;*
  83.  
  84. #scan.c : scan.l
  85. #    flex $(FLEX_FLAGS) scan.l
  86. #    copy lex_yy.c scan.c
  87. #    del lex_yy.c;*
  88. scan.c : scan.dist
  89.     copy scan.dist scan.c
  90.  
  91. ccl.obj : ccl.c flexdef.h
  92.     cc /define=$(CCFLAGS) ccl.c
  93. dfa.obj : dfa.c flexdef.h
  94.     cc /define=$(CCFLAGS) dfa.c
  95. ecs.obj : ecs.c flexdef.h
  96.     cc /define=$(CCFLAGS) ecs.c
  97. main.obj : main.c flexdef.h
  98.     cc /define=($(CCFLAGS),$(SKELETON_FILE),$(F_SKELETON_FILE)) main.c
  99. misc.obj : misc.c flexdef.h
  100.     cc /define=$(CCFLAGS) misc.c
  101. nfa.obj : nfa.c flexdef.h
  102.     cc /define=$(CCFLAGS) nfa.c
  103. parse.obj : parse.c flexdef.h
  104.     cc /define=$(CCFLAGS) parse.c
  105. scan.obj : scan.c parse.h flexdef.h
  106.     cc /define=$(CCFLAGS) scan.c
  107. sym.obj : sym.c flexdef.h
  108.     cc /define=$(CCFLAGS) sym.c
  109. tblcmp.obj : tblcmp.c flexdef.h
  110.     cc /define=$(CCFLAGS) tblcmp.c
  111. yylex.obj : yylex.c parse.h flexdef.h
  112.     cc /define=$(CCFLAGS) yylex.c
  113.  
  114. clean :
  115.     del flex.exe;*
  116.     del scan.c;*
  117.     del parse.c;*
  118.     del parse.h;*
  119.     del lex_yy.c;*
  120.     del *.obj;*
  121.     del flex*.tmp;*
  122.     del *.diff;*
  123.     del y_tab.*;*
  124.     del makefile.;*
  125.     purge/log
  126.     copy makefile.vms makefile.
  127.  
  128. makefile : makefile.vms
  129.     copy makefile.vms makefile.
  130.  
  131. test : flex
  132.     define tools$$lib 'f$$environment("default")'
  133.     flex $(FLEX_FLAGS) scan.l
  134.     define tools$$lib tools$$sys:[lib]
  135.     diff/out=flex.diff scan.dist lex_yy.c
  136.     type/page flex.diff
  137.  
  138.  
  139.  
  140. ######################### Stuff for 8 Bit chars ########################
  141.  
  142.  
  143. Earle Horton has made a version of flex run on the MacIntosh under MPW.  Not
  144. being content to scan regular ascii, he deals with all 8 bits.  I also have
  145. wanted to write VMS filters that recognize <CSI>, etc. so I contacted him
  146. about his work.  He seems to be unable to reach you directly--the rest of
  147. this is his note...
  148. ---------------------------Note from Earle------------------
  149. >From arizona!earleh@eleazar.Dartmouth.EDU Fri May 27 11:33:09 1988
  150. Received: from DARTVAX.DARTMOUTH.EDU by megaron.arizona.edu; Fri, 27 May 88 10:55:39 MST
  151. Received: from eleazar.dartmouth.edu by dartvax.dartmouth.edu (5.59/3.4ROOT)
  152.     id AA17044; Fri, 27 May 88 13:53:18 EDT
  153. Received: by eleazar.dartmouth.edu (5.59/3.2LEAF)
  154.     id AA15906; Fri, 27 May 88 13:53:04 EDT
  155. Date: Fri, 27 May 88 13:53:04 EDT
  156. From: arizona!earleh@eleazar.Dartmouth.EDU (Earle R. Horton)
  157. Message-Id: <8805271753.AA15906@eleazar.dartmouth.edu>
  158. To: eleazar!earleh, earleh@eleazar.Dartmouth.EDU, naucse!jdc
  159. Subject: Re: Flex and DEC multi-nationals, help!
  160. Status: R
  161.  
  162. John,
  163.  
  164.      I have posted the diffs to comp.sources.unix, and I think that
  165. they could be used to generate a VAX C version which scans DEC
  166. multi-nationals with little extra effort.  I tried the address which
  167. you give for Vern several times, only to have it bounce back to me for
  168. some mysterious reason known only to a mail daemon somewhere.  I would
  169. indeed appreciate it if you could forward this to him.
  170.  
  171.      I have found that the full internal representation of all
  172. characters as shorts is not necessary.  Rather, it is only necessary to
  173.  
  174.      a)  Prevent conversion of valid characters to negative ints.  I
  175.          do this with a mask, defined for the Mac and UNIX as 
  176.          "#define BYTEMASK 0xFF".  Any time a char is converted to an
  177.          int, AND it with the mask.  Then you don't have to declare
  178.          chars as unsigned chars, which is tiresome.
  179.  
  180.      b)  The routine mkeccl() uses negation of characters for a flag
  181.          to determine whether they have been processed.  I used a
  182.          debugger to estimate how many times this routine is actually
  183.          called when Flex scans scan.l.  Based on what this looked
  184.          like to me, I decided that it would be appropriate to have
  185.          only the routine mkeccl() use an array of shorts for its
  186.          internal processing.  When mkeccl() is called, it gets a
  187.          pointer to an array of shorts using alloca(), and then reads
  188.          the characters which it is to process into this array using
  189.          the method in (a).  When mkeccl() is done, the shorts are put
  190.          back into chars, and things proceed.  The internal processing
  191.          done by mkeccl() is the same.
  192.  
  193.      Flex compiled with these changes correctly scans all characters
  194. in the Macintosh character set, to the best of my ability to test it.
  195. In addition, it correctly scans chars with values > 127 on a UNIX VAX!
  196. Contrary to "common knowledge", text files which exist on a UNIX
  197. machine may have valid characters in the range [\0177-\0377].  An
  198. example is if I want to write a program to run on a UNIX machine which
  199. converts German characters to ASCII.  The ess-tset (I believe that is
  200. the name) can be converted to "ss" with little loss of sense in most cases.
  201.          
  202.      The only question I have about my procedure is that it looks
  203. expensive to convert the ccltbl array to shorts and back every time
  204. mkeccl() is called.  However, the routine is not called an inordinately
  205. large number of times, and this conversion is probably not more
  206. expensive than a couple of calls to strcpy(), for instance.  To
  207. determine whether this is the most efficient method, one would have to
  208. go through the effort to convert Flex to use shorts for all internal
  209. representation, then profile the two methods.  Not my idea of a good
  210. time.
  211.  
  212.      Flex is a real nice program.  I couldn't find anything else wrong
  213. with it.
  214.  
  215. Earle Horton
  216.  
  217.  
  218.  
  219.  
  220.  
  221.